<?php

namespace app\controller;

use app\BaseController;
use app\model\SystemConfig;
use think\App;

class SystemConfigController extends BaseController
{
    /**
     * @var SystemConfig
     */
    private $dao;

    public function __construct(App $app)
    {
        $this->dao = new SystemConfig();
        parent::__construct($app);
    }

    public function update(SystemConfig $systemConfig)
    {
        $param = $this->request->param('param');

        $systemConfig->param = $param;
        $systemConfig->update_user_id = $this->request->user->id;

        return $this->returnJson($systemConfig->save());
    }


    public function getList(){
       return $this->returnJson($this->dao->with('updateUser')->select());
    }

}